export default {
  namespaced: true,
  state: {
    id: localStorage.getItem("articleId") || "",
    title: localStorage.getItem("articleTitle") || ""
  },
  mutations: {
    // SET_ID(state, value) {
    //   state.id = value;
    //   localStorage.setItem("articleId", value);
    // },
    // SET_TITLE(state, value) {
    //   state.title = value;
    //   localStorage.setItem("articleTitle", value);
    // },
    UPDATE_STATE_VALUE(state, params) {
      for (let key in params) {
        state[key] = params[key].value;
        if (params[key].cacheKey) {
          localStorage.setItem(params[key].cacheKey, params[key].value);
        }
      }
    }
  }
};
